package com.chendx.store.search.mq.queue;

import com.chendx.store.common.constants.goods.GoodsConstants;
import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created by chendx on 2022/5/23.
 */
@Configuration
public class SkuAddQueueConfig {

    @Bean
    public Exchange skuAddExchange(){
        return ExchangeBuilder.topicExchange(GoodsConstants.SKU_ADD_TOPIC).build();
    }

    @Bean
    public Queue addSkuQueue(){
        return new Queue("search_sku_add_queue",true);
    }

    @Bean
    public Binding addSkuBind(){
        return BindingBuilder.bind(addSkuQueue()).to(skuAddExchange()).with("").noargs();
    }
}
